package com.longqinuo.mycarservice.manager;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

/**
 * 自定义数据库帮助类
 * Created by zxw on 2016/5/20.
 */
public class DatabaseOpenHelper extends SQLiteOpenHelper {
    public static final String TABLE_NAME = "collect_car";
    public static final String SERVER_TABLE = "collect_server";

    public DatabaseOpenHelper(Context context) {
        super(context, "car.db", null, 1);
    }


    @Override
    public void onCreate(SQLiteDatabase db) {

        db.execSQL("CREATE TABLE collect_car("+    //创建收藏汽车 表
                "_id  INTEGER NOT NULL,"+
        "car_Id  INTEGER NOT NULL,"+
                "title  TEXT(20) NOT NULL,"+
        "image  TEXT(20) NOT NULL,"+
        "km  DOUBLE(6) NOT NULL,"+
        "buy_date  TEXT(6) NOT NULL,"+
        "price  DOUBLE(6) NOT NULL,"+
        "tab TEXT(8),"+
                "PRIMARY KEY (_id)" +
        ")");
        db.execSQL("CREATE TABLE collect_server("+  //创建收藏套餐 表
                "_id  INTEGER NOT NULL,"+
                "server_Id  INTEGER NOT NULL,"+
                "name  TEXT(20) NOT NULL,"+
                "image  TEXT(8) NOT NULL,"+
                "price  DOUBLE(6) NOT NULL,"+
                "originaPrice  DOUBLE(6) NOT NULL,"+
                "count  INTEGER NOT NULL,"+
                "location  TEXT(20) NOT NULL,"+
                "PRIMARY KEY (_id)" +
                ")");


    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
    }
}
